<?php
namespace Back\Controller;
use Back\Common\BackController;

class IndexController extends BackController{
    public function index(){
        $this -> display();
    }

    public function head(){
        $this -> display();
    }

    public function right(){
        $this -> display();
    }

    //根据权限输出左边的菜单
    public function left(){
        $m = M("manager");
        $mg_id = session("mg_id");
        //查出用户的角色
        $info = $m -> where("mg_id = $mg_id") -> find();
        //根据角色id查权限
        $role_info = $m -> table("__ROLE__") -> where("role_id = {$info['mg_role_id']}") -> find();


        $level0 = $m -> table("__AUTH__") -> where("auth_id in ({$role_info["role_auth_ids"]}) and auth_level = 0") -> select();
        $level1 = $m -> table("__AUTH__") -> where("auth_id in ({$role_info["role_auth_ids"]}) and auth_level = 1") -> select();

        //dump($level0);
        //dump($level1);
        $this -> assign("level0",$level0);
        $this -> assign("level1",$level1);
        $this -> display();
    }
}